package axdoc.rule.check.impl;

import com.alibaba.fastjson.JSONObject;

import axdoc.rule.check.LoadChecksUtil;
import axdoc.rule.check.RangeCheck;

public class CheckConsultRule extends RangeCheck {

	public CheckConsultRule() {
		super();
	}

	public CheckConsultRule(String pattern, int value) {
		this.pattern = pattern;
		this.value = value;
		this.cname = this.getClass().getName();
	}

	@Override
	public boolean check(JSONObject obj) {
		int chat_count = obj.getIntValue("chat_count"); // 患者咨询数
		LoadChecksUtil.logger.info("[校验患者咨询次数][pattern:" + this.getPattern() + "][value:" + this.getValue() + "][chat_count:"
				+ chat_count + "]");
		if (!this.compareNum(this.getPattern(), chat_count, this.getValue())) {
			LoadChecksUtil.logger.info("[校验患者咨询次数][患者咨询次数与配置不匹配]");
			return false;
		}
		return true;
	}

}
